//Embed assets
[Embed("Icons/Delete.png")]public const iconDelete:Class;
[Embed("Icons/Archive.png")]private const iconArchive:Class;
[Embed("Icons/File.png")]private const iconFile:Class;
[Embed("Icons/Image.png")]private const iconImage:Class;
[Embed("Icons/PDF.png")]private const iconPDF:Class;
[Embed("Icons/Video.png")]private const iconVideo:Class;
[Embed("Icons/Flash.png")]private const iconFlash:Class;
[Embed("Icons/Office.png")]private const iconOffice:Class;

//File type array.
private var icons:Array = [
	[iconArchive, 	["rar", "zip"]],
	[iconImage, 	["jpg", "png", "gif", "bmp"]],
	[iconPDF, 		["pdf"]],
	[iconVideo, 	["avi", "wmv"]],
	[iconFlash, 	["fla", "swf"]],
	[iconFlash, 	["doc", "docx", "xls", "xlsx"]]
]

//Get icon depending on file extension
public function getFileIcon(extension:String):Class{
	var ext:String = extension.replace(".","");
	
	for(var i:int=0; i<icons.length; i++){
		var exts:Array = icons[i][1];
		if (exts.indexOf(ext)>-1){
			return Class(icons[i][0]);
		}
	}

	return iconFile;	
}